package com.gw.vip.server.config;

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author GW
 * @description 语音播报服务，只有windows可用
 * @since 2022-08-09
 */
@Configuration
public class DispatchConfig {
    @Bean
    public Dispatch dispatch(){
        ActiveXComponent sap = new ActiveXComponent("Sapi.SpVoice");
        // 音量 0-100
        sap.setProperty("Volume", new Variant(100));
        // 语音朗读速度 -10 到 +10
        sap.setProperty("Rate", new Variant(-3));
        return sap.getObject();
    }
}
